3.8.2 \(\int x^m (a+b x)^2 \, dx\) [702]

Optimal. Leaf size=43 \[ \frac {a^2 x^{1+m}}{1+m}+\frac {2 a b x^{2+m}}{2+m}+\frac {b^2 x^{3+m}}{3+m} \]

[Out]

a^2*x^(1+m)/(1+m)+2*a*b*x^(2+m)/(2+m)+b^2*x^(3+m)/(3+m)

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 43, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {45} \begin {gather*} \frac {a^2 x^{m+1}}{m+1}+\frac {2 a b x^{m+2}}{m+2}+\frac {b^2 x^{m+3}}{m+3} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[x^m*(a + b*x)^2,x]

[Out]

(a^2*x^(1 + m))/(1 + m) + (2*a*b*x^(2 + m))/(2 + m) + (b^2*x^(3 + m))/(3 + m)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin {align*} \int x^m (a+b x)^2 \, dx &=\int \left (a^2 x^m+2 a b x^{1+m}+b^2 x^{2+m}\right ) \, dx\\ &=\frac {a^2 x^{1+m}}{1+m}+\frac {2 a b x^{2+m}}{2+m}+\frac {b^2 x^{3+m}}{3+m}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 38, normalized size = 0.88 \begin {gather*} x^{1+m} \left (\frac {a^2}{1+m}+\frac {2 a b x}{2+m}+\frac {b^2 x^2}{3+m}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[x^m*(a + b*x)^2,x]

[Out]

x^(1 + m)*(a^2/(1 + m) + (2*a*b*x)/(2 + m) + (b^2*x^2)/(3 + m))

________________________________________________________________________________________

Maple [A]
time = 0.12, size = 51, normalized size = 1.19

method result size
norman \(\frac {a^{2} x \,{\mathrm e}^{m \ln \left (x \right )}}{1+m}+\frac {b^{2} x^{3} {\mathrm e}^{m \ln \left (x \right )}}{3+m}+\frac {2 a b \,x^{2} {\mathrm e}^{m \ln \left (x \right )}}{2+m}\) \(51\)
risch \(\frac {x \left (b^{2} m^{2} x^{2}+2 a b \,m^{2} x +3 b^{2} m \,x^{2}+a^{2} m^{2}+8 a b m x +2 x^{2} b^{2}+5 a^{2} m +6 a b x +6 a^{2}\right ) x^{m}}{\left (3+m \right ) \left (2+m \right ) \left (1+m \right )}\) \(86\)
gosper \(\frac {x^{1+m} \left (b^{2} m^{2} x^{2}+2 a b \,m^{2} x +3 b^{2} m \,x^{2}+a^{2} m^{2}+8 a b m x +2 x^{2} b^{2}+5 a^{2} m +6 a b x +6 a^{2}\right )}{\left (3+m \right ) \left (2+m \right ) \left (1+m \right )}\) \(87\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^m*(b*x+a)^2,x,method=_RETURNVERBOSE)

[Out]

a^2/(1+m)*x*exp(m*ln(x))+b^2/(3+m)*x^3*exp(m*ln(x))+2*a*b/(2+m)*x^2*exp(m*ln(x))

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 43, normalized size = 1.00 \begin {gather*} \frac {b^{2} x^{m + 3}}{m + 3} + \frac {2 \, a b x^{m + 2}}{m + 2} + \frac {a^{2} x^{m + 1}}{m + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^m*(b*x+a)^2,x, algorithm="maxima")

[Out]

b^2*x^(m + 3)/(m + 3) + 2*a*b*x^(m + 2)/(m + 2) + a^2*x^(m + 1)/(m + 1)

________________________________________________________________________________________

Fricas [A]
time = 1.16, size = 85, normalized size = 1.98 \begin {gather*} \frac {{\left ({\left (b^{2} m^{2} + 3 \, b^{2} m + 2 \, b^{2}\right )} x^{3} + 2 \, {\left (a b m^{2} + 4 \, a b m + 3 \, a b\right )} x^{2} + {\left (a^{2} m^{2} + 5 \, a^{2} m + 6 \, a^{2}\right )} x\right )} x^{m}}{m^{3} + 6 \, m^{2} + 11 \, m + 6} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^m*(b*x+a)^2,x, algorithm="fricas")

[Out]

((b^2*m^2 + 3*b^2*m + 2*b^2)*x^3 + 2*(a*b*m^2 + 4*a*b*m + 3*a*b)*x^2 + (a^2*m^2 + 5*a^2*m + 6*a^2)*x)*x^m/(m^3
 + 6*m^2 + 11*m + 6)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 299 vs. \(2 (36) = 72\).
time = 0.17, size = 299, normalized size = 6.95 \begin {gather*} \begin {cases} - \frac {a^{2}}{2 x^{2}} - \frac {2 a b}{x} + b^{2} \log {\left (x \right )} & \text {for}\: m = -3 \\- \frac {a^{2}}{x} + 2 a b \log {\left (x \right )} + b^{2} x & \text {for}\: m = -2 \\a^{2} \log {\left (x \right )} + 2 a b x + \frac {b^{2} x^{2}}{2} & \text {for}\: m = -1 \\\frac {a^{2} m^{2} x x^{m}}{m^{3} + 6 m^{2} + 11 m + 6} + \frac {5 a^{2} m x x^{m}}{m^{3} + 6 m^{2} + 11 m + 6} + \frac {6 a^{2} x x^{m}}{m^{3} + 6 m^{2} + 11 m + 6} + \frac {2 a b m^{2} x^{2} x^{m}}{m^{3} + 6 m^{2} + 11 m + 6} + \frac {8 a b m x^{2} x^{m}}{m^{3} + 6 m^{2} + 11 m + 6} + \frac {6 a b x^{2} x^{m}}{m^{3} + 6 m^{2} + 11 m + 6} + \frac {b^{2} m^{2} x^{3} x^{m}}{m^{3} + 6 m^{2} + 11 m + 6} + \frac {3 b^{2} m x^{3} x^{m}}{m^{3} + 6 m^{2} + 11 m + 6} + \frac {2 b^{2} x^{3} x^{m}}{m^{3} + 6 m^{2} + 11 m + 6} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x**m*(b*x+a)**2,x)

[Out]

Piecewise((-a**2/(2*x**2) - 2*a*b/x + b**2*log(x), Eq(m, -3)), (-a**2/x + 2*a*b*log(x) + b**2*x, Eq(m, -2)), (
a**2*log(x) + 2*a*b*x + b**2*x**2/2, Eq(m, -1)), (a**2*m**2*x*x**m/(m**3 + 6*m**2 + 11*m + 6) + 5*a**2*m*x*x**
m/(m**3 + 6*m**2 + 11*m + 6) + 6*a**2*x*x**m/(m**3 + 6*m**2 + 11*m + 6) + 2*a*b*m**2*x**2*x**m/(m**3 + 6*m**2
+ 11*m + 6) + 8*a*b*m*x**2*x**m/(m**3 + 6*m**2 + 11*m + 6) + 6*a*b*x**2*x**m/(m**3 + 6*m**2 + 11*m + 6) + b**2
*m**2*x**3*x**m/(m**3 + 6*m**2 + 11*m + 6) + 3*b**2*m*x**3*x**m/(m**3 + 6*m**2 + 11*m + 6) + 2*b**2*x**3*x**m/
(m**3 + 6*m**2 + 11*m + 6), True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 117 vs. \(2 (43) = 86\).
time = 1.92, size = 117, normalized size = 2.72 \begin {gather*} \frac {b^{2} m^{2} x^{3} x^{m} + 2 \, a b m^{2} x^{2} x^{m} + 3 \, b^{2} m x^{3} x^{m} + a^{2} m^{2} x x^{m} + 8 \, a b m x^{2} x^{m} + 2 \, b^{2} x^{3} x^{m} + 5 \, a^{2} m x x^{m} + 6 \, a b x^{2} x^{m} + 6 \, a^{2} x x^{m}}{m^{3} + 6 \, m^{2} + 11 \, m + 6} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^m*(b*x+a)^2,x, algorithm="giac")

[Out]

(b^2*m^2*x^3*x^m + 2*a*b*m^2*x^2*x^m + 3*b^2*m*x^3*x^m + a^2*m^2*x*x^m + 8*a*b*m*x^2*x^m + 2*b^2*x^3*x^m + 5*a
^2*m*x*x^m + 6*a*b*x^2*x^m + 6*a^2*x*x^m)/(m^3 + 6*m^2 + 11*m + 6)

________________________________________________________________________________________

Mupad [B]
time = 0.37, size = 93, normalized size = 2.16 \begin {gather*} x^m\,\left (\frac {a^2\,x\,\left (m^2+5\,m+6\right )}{m^3+6\,m^2+11\,m+6}+\frac {b^2\,x^3\,\left (m^2+3\,m+2\right )}{m^3+6\,m^2+11\,m+6}+\frac {2\,a\,b\,x^2\,\left (m^2+4\,m+3\right )}{m^3+6\,m^2+11\,m+6}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^m*(a + b*x)^2,x)

[Out]

x^m*((a^2*x*(5*m + m^2 + 6))/(11*m + 6*m^2 + m^3 + 6) + (b^2*x^3*(3*m + m^2 + 2))/(11*m + 6*m^2 + m^3 + 6) + (
2*a*b*x^2*(4*m + m^2 + 3))/(11*m + 6*m^2 + m^3 + 6))

________________________________________________________________________________________